package handler

import (
	"api/basic/global"
	__ "api/basic/proto"
	"api/internal/request"
	"github.com/gin-gonic/gin"
	"net/http"
)

func AddressList(c *gin.Context) {
	req := request.AddressListReq{}
	err := c.ShouldBind(&req)
	if err != nil {
		c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
		return
	}

	order, err := global.TakeOutClient.AddressList(c, &__.AddressListReq{
		Name: req.Name,
	})
	if err != nil {
		c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
		return
	}

	c.JSON(http.StatusOK, gin.H{"data": order})
}
